/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * optionDialog.java
 *
 * Created on 26/01/2012, 09:30:46
 */

package antgeneratorgui;

import java.awt.Color;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Properties;
import javax.swing.JColorChooser;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JTextArea;
import naming.PathContainer;
import org.jdesktop.application.Action;



/**
 *
 * @author lucmussi
 */
public class optionDialog extends javax.swing.JDialog {

    Properties properGral;
    Properties properEclipse;
    Properties properPutty;
    JTextArea areaCon;

    /** Creates new form optionDialog */
    public optionDialog(java.awt.Frame parent, Properties propGral, Properties propEclipse, Properties propPutty, JTextArea areaC) {
        super(parent);
        properGral = propGral;
        properEclipse = propEclipse;
        properPutty = propPutty;
        initComponents();
        areaCon = areaC;
        txt_defaultFolder.setText(properGral.getProperty("defaultDir"));
        txt_eclipse.setText(properEclipse.getProperty("eclipsePath"));
        txt_putty.setText(properPutty.getProperty("puttyPath"));
    }

    public optionDialog(java.awt.Frame parent, Properties propGral, JTextArea areaC) {
        super(parent);
        properGral = propGral;
        initComponents();
        areaCon = areaC;
        txt_defaultFolder.setText(properGral.getProperty("defaultDir"));
        txt_eclipse.setText(properGral.getProperty(PathContainer.ECLIPSEPATH));
        txt_putty.setText(properGral.getProperty(PathContainer.PUTTYPATH));
        txt_sqldeveloper.setText(properGral.getProperty(PathContainer.SQLDEVPATH));
        txt_winscp.setText(properGral.getProperty(PathContainer.WINSCPPATH));
    }

    @Action public void closeOptionDialog() {
        dispose();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        txt_defaultFolder = new javax.swing.JTextField();
        btn_modif = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        box_letra = new javax.swing.JTextField();
        box_fondo = new javax.swing.JTextField();
        btn_guardar = new javax.swing.JButton();
        btn_cancelar = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        txt_eclipse = new javax.swing.JTextField();
        txt_putty = new javax.swing.JTextField();
        btn_cambiar_eclipse = new javax.swing.JButton();
        btn_cambiar_putty = new javax.swing.JButton();
        jLabel6 = new javax.swing.JLabel();
        txt_sqldeveloper = new javax.swing.JTextField();
        btn_cambiar_sqldev = new javax.swing.JButton();
        jLabel7 = new javax.swing.JLabel();
        txt_winscp = new javax.swing.JTextField();
        btn_cambiar_winscp = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Opciones");
        setModal(true);
        setName("Form"); // NOI18N
        setResizable(false);

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Entorno"));
        jPanel1.setName("jPanel1"); // NOI18N

        jLabel1.setText("Carpeta por Defecto:");
        jLabel1.setName("jLabel1"); // NOI18N

        txt_defaultFolder.setEditable(false);
        txt_defaultFolder.setName("txt_defaultFolder"); // NOI18N

        btn_modif.setText("Modificar");
        btn_modif.setName("btn_modif"); // NOI18N
        btn_modif.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_modifActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(86, 86, 86)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txt_defaultFolder, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(89, 89, 89)
                        .addComponent(btn_modif)))
                .addContainerGap(101, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txt_defaultFolder, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addGap(19, 19, 19)
                .addComponent(btn_modif)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Consola"));
        jPanel2.setName("jPanel2"); // NOI18N

        jButton1.setText("Cambiar");
        jButton1.setName("jButton1"); // NOI18N
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setText("Cambiar");
        jButton2.setName("jButton2"); // NOI18N
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jLabel2.setText("Letra");
        jLabel2.setName("jLabel2"); // NOI18N

        jLabel3.setText("Fondo");
        jLabel3.setName("jLabel3"); // NOI18N

        box_letra.setBackground(Color.decode(properGral.getProperty("fontColor")));
        box_letra.setEnabled(false);
        box_letra.setName("box_letra"); // NOI18N
        box_letra.setSelectionColor(Color.decode(properGral.getProperty("fontColor")));

        box_fondo.setBackground(Color.decode(properGral.getProperty("bgColor")));
        box_fondo.setEnabled(false);
        box_fondo.setName("box_fondo"); // NOI18N
        box_fondo.setSelectionColor(Color.decode(properGral.getProperty("bgColor")));

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(148, 148, 148)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(box_letra, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(box_fondo, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jButton2))
                .addContainerGap(150, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(box_letra, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton1))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton2)
                    .addComponent(jLabel3)
                    .addComponent(box_fondo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        btn_guardar.setText("Guardar");
        btn_guardar.setEnabled(false);
        btn_guardar.setName("btn_guardar"); // NOI18N
        btn_guardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_guardarActionPerformed(evt);
            }
        });

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(antgeneratorgui.AntGeneratorGUIApp.class).getContext().getActionMap(optionDialog.class, this);
        btn_cancelar.setAction(actionMap.get("closeOptionDialog")); // NOI18N
        btn_cancelar.setName("btn_cancelar"); // NOI18N

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Aplicaciones"));
        jPanel3.setMaximumSize(new java.awt.Dimension(533, 119));
        jPanel3.setName("jPanel3"); // NOI18N

        jLabel4.setText("Eclipse:");
        jLabel4.setName("jLabel4"); // NOI18N

        jLabel5.setText("PuTTY:");
        jLabel5.setName("jLabel5"); // NOI18N

        txt_eclipse.setEditable(false);
        txt_eclipse.setMaximumSize(new java.awt.Dimension(6, 20));
        txt_eclipse.setName("txt_eclipse"); // NOI18N

        txt_putty.setEditable(false);
        txt_putty.setMaximumSize(new java.awt.Dimension(6, 20));
        txt_putty.setName("txt_putty"); // NOI18N

        btn_cambiar_eclipse.setText("Cambiar");
        btn_cambiar_eclipse.setName("btn_cambiar_eclipse"); // NOI18N
        btn_cambiar_eclipse.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_cambiar_eclipseActionPerformed(evt);
            }
        });

        btn_cambiar_putty.setText("Cambiar");
        btn_cambiar_putty.setName("btn_cambiar_putty"); // NOI18N
        btn_cambiar_putty.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_cambiar_puttyActionPerformed(evt);
            }
        });

        jLabel6.setText("SQL Developer:");
        jLabel6.setName("jLabel6"); // NOI18N

        txt_sqldeveloper.setEditable(false);
        txt_sqldeveloper.setMaximumSize(new java.awt.Dimension(6, 20));
        txt_sqldeveloper.setName("txt_sqldeveloper"); // NOI18N

        btn_cambiar_sqldev.setText("Cambiar");
        btn_cambiar_sqldev.setName("btn_cambiar_sqldev"); // NOI18N
        btn_cambiar_sqldev.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_cambiar_sqldevActionPerformed(evt);
            }
        });

        jLabel7.setText("WinSCP:");
        jLabel7.setName("jLabel7"); // NOI18N

        txt_winscp.setEditable(false);
        txt_winscp.setMaximumSize(new java.awt.Dimension(6, 20));
        txt_winscp.setName("txt_winscp"); // NOI18N

        btn_cambiar_winscp.setText("Cambiar");
        btn_cambiar_winscp.setName("btn_cambiar_winscp"); // NOI18N
        btn_cambiar_winscp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_cambiar_winscpActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jLabel7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txt_winscp, javax.swing.GroupLayout.DEFAULT_SIZE, 304, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btn_cambiar_winscp))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel5)
                            .addComponent(jLabel4))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txt_eclipse, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(txt_putty, javax.swing.GroupLayout.DEFAULT_SIZE, 309, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(btn_cambiar_eclipse)
                            .addComponent(btn_cambiar_putty, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                        .addComponent(jLabel6)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txt_sqldeveloper, javax.swing.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btn_cambiar_sqldev)))
                .addGap(55, 55, 55))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btn_cambiar_eclipse)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel4)
                            .addComponent(txt_eclipse, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txt_putty, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel5)
                            .addComponent(btn_cambiar_putty))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btn_cambiar_sqldev)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txt_sqldeveloper, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel6)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btn_cambiar_winscp)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txt_winscp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel7)))
                .addContainerGap(44, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(110, 110, 110)
                .addComponent(btn_guardar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 84, Short.MAX_VALUE)
                .addComponent(btn_cancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(123, 123, 123))
            .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btn_guardar)
                    .addComponent(btn_cancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btn_modifActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_modifActionPerformed
        JFileChooser chooser = new JFileChooser(properGral.getProperty("defaultDir"));
        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        int returnVal = chooser.showOpenDialog(null);
        if(returnVal == JFileChooser.APPROVE_OPTION) {
            txt_defaultFolder.setText(chooser.getSelectedFile().toString());
        }
        btn_guardar.setEnabled(true);
    }//GEN-LAST:event_btn_modifActionPerformed

    private void btn_guardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_guardarActionPerformed
        OutputStream newPropFile = null;
        try {
            newPropFile = new FileOutputStream(System.getProperty("user.dir")+"\\config\\config.properties");
            properGral.setProperty("defaultDir", txt_defaultFolder.getText());
            properGral.setProperty("fontColor", String.valueOf(areaCon.getForeground().getRGB()));
            properGral.setProperty("bgColor", String.valueOf(areaCon.getBackground().getRGB()));

            if(!txt_eclipse.getText().equals("")){
                //newPropFile = new FileOutputStream(System.getProperty("user.dir")+"\\config\\eclipse.properties");
                //properEclipse.setProperty("eclipsePath", txt_eclipse.getText());
                properGral.setProperty(PathContainer.ECLIPSEPATH, txt_eclipse.getText());
//                properEclipse.store(newPropFile, "New Eclipse Path File");
//                newPropFile.close();
            }
            if(!txt_putty.getText().equals("")){
                //newPropFile = new FileOutputStream(System.getProperty("user.dir")+"\\config\\putty.properties");
                //properEclipse.setProperty("puttyPath", txt_putty.getText());
                properGral.setProperty(PathContainer.PUTTYPATH, txt_putty.getText());
//                properEclipse.store(newPropFile, "New PuTTY Path File");
//                newPropFile.close();
            }
            if(!txt_sqldeveloper.getText().equals("")){
                //newPropFile = new FileOutputStream(System.getProperty("user.dir")+"\\config\\sqldev.properties");
                //properEclipse.setProperty("sqldevPath", txt_sqldeveloper.getText());
                properGral.setProperty(PathContainer.SQLDEVPATH, txt_sqldeveloper.getText());
//                properEclipse.store(newPropFile, "New SQL Developer Path File");
//                newPropFile.close();
            }
            if(!txt_winscp.getText().equals("")){
                //newPropFile = new FileOutputStream(System.getProperty("user.dir")+"\\config\\winscp.properties");
                //properEclipse.setProperty("winscpPath", txt_winscp.getText());
                properGral.setProperty(PathContainer.WINSCPPATH, txt_winscp.getText());
//                properEclipse.store(newPropFile, "New WinSCP Path File");
//                newPropFile.close();
            }
            properGral.store(newPropFile, "New Config File");
            newPropFile.close();
        } catch (FileNotFoundException ex) {
            JOptionPane.showMessageDialog(null, "No se encontró el archivo","ERROR", JOptionPane.ERROR_MESSAGE);
        } catch (IOException ioex) {
            JOptionPane.showMessageDialog(null, "Error de E/S","ERROR", JOptionPane.ERROR_MESSAGE);
        }
        btn_guardar.setEnabled(false);
    }//GEN-LAST:event_btn_guardarActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        Color colorInicial = Color.decode(properGral.getProperty("fontColor"));
        Color nuevoColor = JColorChooser.showDialog(null, "Elegir Color", colorInicial);
        if(nuevoColor != null){
            areaCon.setForeground(nuevoColor);
            box_letra.setBackground(nuevoColor);
            btn_guardar.setEnabled(true);
        }
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        Color colorInicial = Color.decode(properGral.getProperty("bgColor"));
        Color nuevoColor = JColorChooser.showDialog(null, "Elegir Color", colorInicial);
        if(nuevoColor != null){
            areaCon.setBackground(nuevoColor);
            box_fondo.setBackground(nuevoColor);
            btn_guardar.setEnabled(true);
        }
    }//GEN-LAST:event_jButton2ActionPerformed

    private void btn_cambiar_eclipseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_cambiar_eclipseActionPerformed
        JFileChooser chooser = new JFileChooser(txt_eclipse.getText());
        int returnVal = chooser.showOpenDialog(null);
        while(returnVal == JFileChooser.APPROVE_OPTION && !chooser.getSelectedFile().getName().endsWith("ipse.exe")){
            JOptionPane.showMessageDialog(null, "El archivo "+ chooser.getSelectedFile() + " no es un ejecutable de eclipse",
                                                "Open Error", JOptionPane.ERROR_MESSAGE);
            returnVal = chooser.showOpenDialog(null);
        }
        if(returnVal == JFileChooser.APPROVE_OPTION){
            txt_eclipse.setText(chooser.getSelectedFile().toString());
            btn_guardar.setEnabled(true);
        }
    }//GEN-LAST:event_btn_cambiar_eclipseActionPerformed

    private void btn_cambiar_puttyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_cambiar_puttyActionPerformed
        JFileChooser chooser = new JFileChooser(txt_putty.getText());
        int returnVal = chooser.showOpenDialog(null);
        while(returnVal == JFileChooser.APPROVE_OPTION && !chooser.getSelectedFile().getName().endsWith("tty.exe")){
            JOptionPane.showMessageDialog(null, "El archivo "+ chooser.getSelectedFile() + " no es un ejecutable de putty",
                                                "Open Error", JOptionPane.ERROR_MESSAGE);
            returnVal = chooser.showOpenDialog(null);
        }
        if(returnVal == JFileChooser.APPROVE_OPTION){
            txt_putty.setText(chooser.getSelectedFile().toString());
            btn_guardar.setEnabled(true);
        }
    }//GEN-LAST:event_btn_cambiar_puttyActionPerformed

    private void btn_cambiar_sqldevActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_cambiar_sqldevActionPerformed
        JFileChooser chooser = new JFileChooser(txt_sqldeveloper.getText());
        int returnVal = chooser.showOpenDialog(null);
        while(returnVal == JFileChooser.APPROVE_OPTION && !chooser.getSelectedFile().getName().endsWith("loper.exe")){
            JOptionPane.showMessageDialog(null, "El archivo "+chooser.getSelectedFile()+" no es un ejecutable de SQL Developer",
                                                "Open Error", JOptionPane.ERROR_MESSAGE);
            returnVal = chooser.showOpenDialog(null);
        }
        if(returnVal == JFileChooser.APPROVE_OPTION){
            txt_sqldeveloper.setText(chooser.getSelectedFile().toString());
            btn_guardar.setEnabled(true);
        }
    }//GEN-LAST:event_btn_cambiar_sqldevActionPerformed

    private void btn_cambiar_winscpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_cambiar_winscpActionPerformed
        JFileChooser chooser = new JFileChooser(txt_winscp.getText());
        int returnVal = chooser.showOpenDialog(null);
        while(returnVal == JFileChooser.APPROVE_OPTION && !chooser.getSelectedFile().getName().endsWith("SCP.exe")){
            JOptionPane.showMessageDialog(null, "El archivo "+chooser.getSelectedFile()+" no es un ejecutable de WinSCP",
                                                "Open Error", JOptionPane.ERROR_MESSAGE);
            returnVal = chooser.showOpenDialog(null);
        }
        if(returnVal == JFileChooser.APPROVE_OPTION){
            txt_winscp.setText(chooser.getSelectedFile().toString());
            btn_guardar.setEnabled(true);
        }
    }//GEN-LAST:event_btn_cambiar_winscpActionPerformed

    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField box_fondo;
    private javax.swing.JTextField box_letra;
    private javax.swing.JButton btn_cambiar_eclipse;
    private javax.swing.JButton btn_cambiar_putty;
    private javax.swing.JButton btn_cambiar_sqldev;
    private javax.swing.JButton btn_cambiar_winscp;
    private javax.swing.JButton btn_cancelar;
    private javax.swing.JButton btn_guardar;
    private javax.swing.JButton btn_modif;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    public javax.swing.JTextField txt_defaultFolder;
    private javax.swing.JTextField txt_eclipse;
    private javax.swing.JTextField txt_putty;
    private javax.swing.JTextField txt_sqldeveloper;
    private javax.swing.JTextField txt_winscp;
    // End of variables declaration//GEN-END:variables

}
